#ifndef UARTCOM_H
#define UARTCOM_H
#include "include.h"

#define huart1_EC20_DMARxdata_MAX 	                0x0500
#define huart2_screen_DMARxdata_MAX 	                0x0100
#define huart3_XYencoder_DMARxdata_MAX 	                0x0100
#define huart4_DMARxdata_MAX	                        0x0100
#define huart5_motor_driver_DMARxdata_MAX 	        0x0100
#define huart6_DMARxdata_MAX 	                        0x0100

#define huart1_EC20_DMATxdata_MAX 	                0x0040
#define huart2_screen_DMATxdata_MAX	                0x0040
#define huart3_XYencoder_DMATxdata_MAX 	                0x0040
#define huart4_BJencoder_DMATxdata_MAX 	                0x0020
#define huart5_motor_driver_DMATxdata_MAX 	        0x0040
#define huart6_DMATxdata_MAX 	                        0x0100
extern uint8_t uart1_EC20_rxbuf[huart1_EC20_DMARxdata_MAX];
extern uint8_t uart1_EC20_txbuf[huart1_EC20_DMATxdata_MAX];

extern uint8_t uart2_screen_rxbuf[huart2_screen_DMARxdata_MAX];
extern uint8_t uart2_screen_txbuf[huart2_screen_DMATxdata_MAX];

extern uint8_t uart3_XYencoder_rxbuf[huart3_XYencoder_DMARxdata_MAX];
extern uint8_t uart3_XYencoder_txbuf[huart3_XYencoder_DMATxdata_MAX];

extern uint8_t uart4_encoder_rxbuf[huart4_DMARxdata_MAX];
extern uint8_t uart4_encoder_txbuf[huart4_DMARxdata_MAX];

extern uint8_t uart5_motor_driver_rxbuf[huart5_motor_driver_DMARxdata_MAX];
extern uint8_t uart5_motor_driver_txbuf[huart5_motor_driver_DMATxdata_MAX];

void uart1_clearrxbuf( void );
void uart2_clearrxbuf( void );
void uart3_clearrxbuf( void );
void uart4_clearrxbuf( void );
void uart5_clearrxbuf( void );

void uart1_init( void *callback );
void uart2_init( void *callback );
void uart3_init( void *callback );
void uart4_init( void *callback );
void uart5_init( void *callback );
void uart6_init( void *callback );

void uart1_recv( void );
void uart2_recv( void );
void uart3_recv( void );
void uart4_recv( void );
void uart5_recv( void );
void uart6_recv( void );
#endif